﻿
// 对话框回调

function iiWeb_DialogCallback(command, args) {
    switch (command) {
        case "CloseRefresh": //关闭并刷新
            $(args.frameElement.parentNode).dialog("close");
            $("#OKButton").click();
            break;
        case "Close": //关闭
            $(args.frameElement.parentNode).dialog("close");
            break;
        case "OK": //选择客户回调
            $(args.host.frameElement.parentNode).dialog("close");

            var returnStr = args.returnStr;
            var cust = returnStr.split(',');
            $('#hidCustomerNo').val(cust[0]);
            $('#txtCustomerName').val(cust[1]);

            break;
    }
}

// 初始化

$(function () {

    // 新增

    $("#CreateButton").click(function () {
        iiWeb_ShowDialog(
            "PatentDetail.aspx",
            720,
            500
        );
        return false;
    });

    // 编辑

    $(".ImageButtonEdit").click(function () {
        iiWeb_ShowDialog(
            "PatentDetail.aspx?ID={0}".format(escape($(this).attr("title"))),
            720,
            500
        );
        return false;
    });

    // 删除

    $("#DeleteButton").click(function () {
        return confirm(iiWeb_ConfirmMessage);
    });

    // 文件

    $(".ImageButtonDetail").click(function () {
        iiWeb_ShowDialog(
            "UploadFiles.aspx?RelatedId={0}&UploadFileType=Patent".format(escape($(this).attr("title"))),
            720,
            420
        );
        return false;
    });

    //导出Excel
    $("#ExcelButton").click(function () {
        //window.location.href = "PatentReport.ashx?ReportType=ExcelOpenXml";
        window.open("PatentReport.ashx?ReportType=ExcelOpenXml");
    });


    //选择客户
    $("#selCust").click(function () {
        iiWeb_ShowDialog(
            "SelectCust.aspx",
            650,
            420
        );
        return false;
    });
});

